<?php 
	defined('_JEXEC') or die('Restricted access');
	JHTML::_('behavior.modal');
?>
<?php //echo @$this->lists['search']?>
<?php  
$flights = $this->flights;
$db			=& JFactory::getDBO();
//print_r($hotels);
?>
<div class="article-title-indent png">
<table class="contentpaneopen">
    <tbody>
        <tr>
        <td class="contentheading" width="100%">
	        <h3>Flights</h3>
        </td>
      	</tr>
    </tbody>
</table>
</div>
<div>
	<ul class="list-custom3">
    	<li>
        	<table class="fht-table fancyTable" width="100%" cellspacing="2" cellpadding="0" border="0">
            	<thead>
            	<tr class="header_top" style="background-color:#EBEBEB; height:20px;">
                	<th width="25%"><b>Depart</b></th>
                	<th><b>Arrive</b></th>
                	<th width=""><b>ETA Depart</b></th>
                	<th width=""><b>ETA Arrive</b></th>
                	<th width=""><b>Aircraft</b></th>
                	<th width="" style="text-align:center;"><b>Detail</b></th>
                </tr>
               </thead>
  			<?php for($i=0;$i<count($flights);$i++){
				if($i%2==0){?>
            	<tr>
                <?php }
				else{?>
					<tr style="background-color:#F4F4F4;">
				<?php }?>
                	<td height="30" style="vertical-align:middle;"><?php echo $flights[$i]->depart;?></td>
                    <?php $select = "SELECT location_name FROM #__flight_destination where id=".$flights[$i]->arrive_id;
							$db->setQuery($select);
							$row = $db->loadObject();?>
                	<td style="vertical-align:middle;"><?php echo $row->location_name;?></td>
                	<td style="vertical-align:middle;"><?php echo $flights[$i]->eta_depart;?></td>
                	<td style="vertical-align:middle;"><?php echo $flights[$i]->eta_arrive;?></td>
                	<td style="vertical-align:middle;"><?php echo $flights[$i]->aircraft_name;?></td>
                	<td class="cartd youngOrange" style="text-align:center;vertical-align:middle;"><a class="modal" href="<?php echo $this->baseurl ?>/send_mail/view_flight.php?id=<?php echo $flights[$i]->id?>" rel="{handler: 'iframe', size: {x: 480, y: 300}}">View</a></td>
                </tr>
   			<?php }?>
            </table>
        </li>
    </ul>
</div>